<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<jsp:include page="header.jsp"></jsp:include>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>用户登录</title>
		<meta name="author" content="Administrator" />
		<!-- Date: 2014-10-28 -->
		<%
			String path = request.getContextPath();
			String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
		%>
		<base href="<%=basePath%>">
		<link  rel="stylesheet"  type="text/css"  href="<%=basePath %>/template/shop/css/login.css">
		<%-- <script type="text/javascript" src="<%=basePath %>/template/shop/css/js/jquery-1.11.1.min.js"></script> --%>
		<script type="text/javascript">
		    $(function(){
		    	
		    	$("#loginBar").submit(function(){
		    		var flagVerifyCode =false;
		    		$.ajax({
		                type: "get",
		                async:false,
		                url: "./account/checkVerifyCode",
		                dataType: "json",
		                data: { "verifyCode": $("#iptlogin").val() },
		                success: function (data) {
		                	if(data!=true){
		                		flagVerifyCode=false;
		                		$("#message").html("验证码输入不正确");
		                	}else{
		                		flagVerifyCode=true;
		                	}
		                	
		                },
		                error: function () {
		                    alert("IP地址有问题1");
		                }
		            });
		    		
		    		if(flagVerifyCode!=true){
		    			return false;
		    		}
		    	});
		    	$("#imageChange").click(function(event){
		    		 $("#membervocde").attr("src","account/getVerifyCode?"+Math.random());
		    		 event.stopPropagation(); 
		    	});
		    	
		    })
	    </script>
	</head>
	<input type="hidden" value="${randomString}" id="randomString">
	<body>
		<div class="all-wrap" id="container">
			<div class="RegisterWrap">
			 <!-- <h3 class="page-title">会员登录</h3> -->
			<div class="passport_case passport_login_case" style="background: url('template/shop/images/login.jpg') no-repeat scroll 0 0 rgba(0, 0, 0, 0);">
			<form id="loginBar" method="post" action="account/login">
			  <div class="loginbox">
			    <ul>
			      <li>
			      <label class="login-k">登录帐号</label>
			      <div class="login-v common_form_val"><input type="text" value="" tabindex="1" id="uname" vtype="required" name="uname" class="x-input inputstyle" autocomplete="off"></div>
			      </li>
			      <li>
			      <label class="login-k">密码</label>
			      <div class="login-v common_form_val passport_login_pass"><input type="password" onpaste="return false;" oncontextmenu="return false;" tabindex="2" id="password" vtype="required" name="password" class="x-input inputstyle">&nbsp;&nbsp;<a href="/passport-lost.html" class="link">忘记密码</a></div>
			      </li>
			            <li>
			      <label class="login-k">验证码</label>
			      <div class="login-v passport_login_kocde common_form_val"><input type="text" tabindex="3" id="iptlogin" name="verifycode" maxlength="4" size="4" vtype="required&amp;&amp;number" class="x-input " autocomplete="off"> 
			      <span class="verifyCodebox">
				      <img align="absmiddle" src="<%=basePath %>account/getVerifyCode" id="membervocde"> 
				      <a href="javascript:void(0)" class="link" id="imageChange">换一张</a>
			      </span>
			      </div>
			      <!-- <img title="点击更换" onclick="javascript:refresh(this);" src="imageServlet"> -->
			      </li>
			      <li><div id="message" style="color: red;margin-left: 128px;">${message }</div></li>
			      <li>
				      <label class="login-k">&nbsp;</label>
				      <div class="login-v common_form_sub signup_sub">
				        <input type="submit" data-ajax-config="{onComplete:function(rs){ if(rs[0]&amp;&amp;rs[0].error){ changeimg('membervocde');}}}" value="登  录" tabindex="4" rel="_request">&nbsp;&nbsp;<a href="account/register" class="link sign">立即注册</a>
				        <input type="hidden" value="" name="forward">
				      </div>
				      
			      </li>
			    </ul>
			  </div>
			</form>
			</div>
			
		<!--第三方登录iframe-->
				<script>
				  /* $('#loginBar input').addEvent('focus',function(){
				    if($(this.form).retrieve('showvcode',false))return;
				    changeimg('membervocde');
				    $$('.verifyCodebox').setStyle('display','');
				    $(this.form).store('showvcode',true);
				  }); */
				  function changeimg(id){
				    $(id).set('src','/passport-gen_vcode.html#'+(+new Date()));
				  }
				</script>
			</div>
			<div class="clear"></div>
		</div>
		<script type="text/javascript">
		//alert(document.body.scrollWidth );
		//$("#navTotal").css("width",document.body.scrollWidth);
		function setWidth() {
			$("#navTotal,#container").width(document.body.scrollWidth);
		}
		$("#bodyContent,#CON--bg").width(document.body.scrollWidth);
		setInterval(setWidth, 1000);
	</script>
	</body>
</html>